Professional Documents
Culture Documents
• Overview
• Servlet Mappings
• Web Viewer Web.xml Settings
• Parameters
• Viewer Directory Structure
• Viewer Tag Library
Overview
This Viewer is an AJAX based J2EE application that illustrates using the BIRT engine
to generate and render report content.
The Web Viewer can be used to generate and render reports, and also supports more
interactive features such as table of contents, exporting report content to several
formats, client and server side printing, as well as report pagination. The features
available will depend on what servlet mapping is used, the settings available in the
web.xml file and what values are passed as parameters.
The Example Viewer also ships with a tag library which can be used to provide report
functionality within your existing web applications.
Servlet Mappings
The BIRT Web Viewer consist of two main Servlets, the ViewerServlet and the
BirtEngineServlet. These Servlets handle three mappings: ( /frameset, /run, and
/preview).
The /frameset mapping renders the report in the full AJAX viewer complete with
toolbar, navigation bar and table of contents features. This mapping also generates an
intermediate report document from the report design file to support the AJAX based
features.
eg
http://localhost:8080/viewer/frameset?__report=myreport.rptdesign&parm1=value1
The /run mapping runs and renders the report but does not create a report document.
This mapping does not supply HTML pagination, TOC or toolbar features, but does
use the AJAX framework to collect parameters, support report cancelling and retrieve
the report output in HTML format.
eg http://localhost:8080/viewer/run?__report=myreport.rptdesign&parm1=value1
The /preview mapping runs and renders the report and does not generate a report
document, although an existing report document can be used in which case just the
render operation occurs. The output from the run and render operation is sent directly
to the browser.
eg http://localhost:8080/viewer/preview?__report=myreport.rptdesign&parm1=value1
Attribute Description
This setting sets the default locale for
BIRT_VIEWER_LOCALE
the Web Viewer.
This is the default location for report
designs. If the report design specified in
BIRT_VIEWER_WORKING_FOLDER
a URL parameter is relative, this path is
pre-pended to the report name.
If a report document parameter
(__document) is not used, this is the
location that report documents will be
generated in. If this setting is left blank,
BIRT_VIEWER_DOCUMENT_FOLDER the default value “webapp/documents”
will be used. If the__document URL
parameter is used and the value is
relative the report document will be
created in the working folder.
If this value is set to true, reports will
only be searched for, relative to the
working folder. This prevents a user
WORKING_FOLDER_ACCESS_ONLY
from entering a full path to a report.
Relative paths below the working folder
are accessible.
BIRT_VIEWER_IMAGE_DIR Specifies the default location to store
temporary images generated by the
report engine. If this setting is left
blank, the default location of
webapp/report/images is used.
Specifies the default location to store
report engine log files. If this setting is
BIRT_VIEWER_LOG_DIR
left blank, the default location of
webapp/logs is used.
Sets the report engine log level. Valid
values are:
OFF
SEVERE
WARNING
BIRT_VIEWER_LOG_LEVEL
INFO
CONFIG
FINE
FINER
FINEST
Specifies the default location to place
Jar files used by the script engine.
These can be Jars used by script engine
or jars containing event handlers written
BIRT_VIEWER_SCRIPTLIB_DIR
in Java. These Jars are appended to the
classpath. If this setting is left blank the
default value of webapp/scriptlib will be
used.
This setting specifies the resource path
used by report engine. The resource
path is used to search for libraries,
BIRT_RESOURCE_PATH images, and properties files used by a
report. If this setting is left blank,
resources will be searched for in the
same directory as the report.
Specifies the maximum number of rows
BIRT_VIEWER_MAX_ROWS
to retrieve from a dataset.
Specifies whether to overwrite the
report document every time a report is
BIRT_OVERWRITE_DOCUMENT
executed. The default is set to true.
Valid values are true and false.
Specifies the location of the
BIRT_VIEWER_CONFIG_FILE viewer.properties file. This file contains
various settings used by the viewer.
This setting specifies whether server
side printing is supported. If set to OFF
BIRT_VIEWER_PRINT_SERVERSIDE the toolbar icon used for server side
printing will be removed automatically.
Valid values are ON and OFF.
This setting determines how BIRT styles
are handled with the HTML emitter. If
set to TRUE, the BIRT engine will
output the styles directly to the report
and depends on the browser to
HTML_ENABLE_AGENTSTYLE_ENGINE
implement the style calculations. If set
to FALSE the emitter will use the BIRT
style engine to calculate the styles and
will output the results directly to the
report.
Parameters
The example viewer has a distinction between report parameters and viewer
configuration parameters. Report parameters are used by the report designs and
configuration parameters affect the appearance and features available to the example
Viewer application. In either case these parameters can be passed as URL parameters
by entering the &parmname=value syntax, passed in a html form, or passed using the
jsp:parm tag. Configuration parameters by default start with a “__” prefixed to the
parameter name.
Report parameters that are designated in the design as required and are not entered in
one of the above methods will cause the viewer to launch a parameter entry dialog
box. Additionally the example Viewer tag library contains tags to configure and set
parameters as well.
Attribute Description
__id A unique identifier for the viewer.
__title Sets the report title.
Determines if the report title is shown in the frameset viewer.
__showTitle
Defaults to true. Valid values are true and false.
Determines if the report toolbar is shown in the frameset viewer.
__toolbar
Defaults to true. Valid values are true and false.
Determines if the navigation bar is shown in the frameset viewer.
__navigationbar
Defaults to true. Valid values are true and false.
Determines if the parameter page is displayed. By default the
frameset, run and preview mappings will automatically determine if
__parameterpage
the parameter page is required. This setting will override this
behavior. Valid values are true and false.
Sets the name of the report design to process. This can be an
__report absolute path or relative to the working folder (See web.xml
settings).
__document Sets the name for the rptdocument. The document is created when
the report engine separates run and render tasks, and is used to
support features like table of contents and pagination. This setting
can be an absolute path or relative to the working folder (See
web.xml settings). If no document parameter is used, a unique
document is created in the document folder (see web.xml settings).
Specifies the desired output format, such as pdf, html, doc, ppt, or
__format
xls.
Specifies the locale for the specific operation. Note that this will
override the default locale. Order of precedence is as follows:
__locale parameter.
__locale
Locale from client browser.
Most of the directories are configurable using variables set within web.xml. The
WEB-INF/platform, webcontent, and WEB-INF/lib directories are exceptions.
The BIRT plugins and associated OSGi configuration files are located in the WEB-
INF/platform directory. This directory is hard coded in the Viewer, but allows the
application to be deployed in WAR format. When deployed in this manner the Viewer
source will create a copy of the platform directory in a directory that is set with the
system variable javax.servlet.context.tempdir. Once the platform directory is
created the BIRT plugins will be copied to the tempdir and the Platform is then
started.
The webcontent directory contains the JavaScript files used for AJAX
communications, the JSP fragments used to construct the Viewer instance, image files
used by the Viewer, and the cascading style sheets used within the Viewer.
The WEBINF/lib directory contains the required Jars for the Viewer to operate.
Additional Jar files that are used by deployed reports can be placed in the WEB-
INF/lib or the scriptlib directories. See the web.xml settings section for additional
details.
Viewer Tag Library
The Web Viewer now contains a tag library that can be used to customize the behavior
of the Viewer. This tag library can be deployed by either deploying the viewer as
normal or by using the BIRT Web Deployment project wizard. In addition, if you
desire to have BIRT deployed in one context and include the tag library in a separate
context this can be done by copying the birt.tld file to your WEB-INF lds directory
and copying coreapi.jar, modelapi,jar, viewerservlets.jar and
com.ibm.icu_3.6.1v20070417.jar from the Viewer libs directory to the new
context/web-inf/lib directory. Add the following reference to your web.xml
<jsp-config>
<taglib>
<taglib-uri>/birt.tld</taglib-uri>
<taglib-location>/WEB-
INF/tlds/birt.tld</taglib-location>
</taglib>
</jsp-config>
Using this approach reports are referenced in relation to the BIRT Viewer not the new
context.
The Viewer tag library contains five tags param, paramDef, parameterPage, report and
viewer. Each tag has multiple attributes that control the behavior of the Viewer.
Example JSP